package com.layui.repository;

import java.util.List;

import org.springframework.data.jpa.repository.Query;

import com.layui.common.BaseRepository;
import com.layui.entity.Address;

/**
 * @author LiShuai
 * @date 2019年2月24日
 */
public interface AddressRepository extends BaseRepository<Address, String> {

	@Query("select m from Address m where m.pid=?1 and m.status=1")
	List<Address> findProvinceByPid(Long pid);

	@Query("select m from Address m where m.pid=?1 and m.status=1")
	List<Address> findCityByPid(Long pid);

	@Query("select m from Address m where m.pid=?1 and m.status=1")
	List<Address> findCountyByPid(long pid);

	/**
	 * 省市县三级查询整合
	 * 
	 * @param pid
	 * @return
	 */
	@Query("select m from Address m where m.pid=?1 and m.status=1")
	List<Address> findAddressByPid(Long pid);

}
